package cn.com.open.ms.ecgpaasdatarest.mapper;

import cn.com.open.ms.ecgpaasdatarest.databasemodel.App;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * @Description TODO
 * @Author 奶茶
 * Created by on 2018/11/30 10:17.
 */
@Mapper
public interface AppMapper {

    @Select("SELECT\n" +
            "\tapp.app_secret\n" +
            "FROM\n" +
            "\tapp\n" +
            "JOIN business_table bt ON bt.app_key = app.app_key\n" +
            "WHERE\n" +
            "\tapp.app_key = #{appKey}\n" +
            "AND bt.business_name = #{businessName}\n" +
            "AND bt.table_name = #{tableName}\n" +
            "AND bt.deleted = #{deleteStatus}\n" +
            "LIMIT 1")
    String findAppSecretByAppkey(@Param(value = "appKey") String appKey,@Param(value = "businessName") String businessName,@Param(value = "tableName") String tableName,@Param(value = "deleteStatus") Integer deleteStatus);

}
